<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的优惠券 - 超市系统</title>
    <link rel="stylesheet" href="styles/main.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link rel="stylesheet" href="/styles/coupons-ai.css">
    <script src="/js/jquery-1.12.4.min.js"></script>
    <script src="js/vue.js"></script>
    <link rel="icon" href="/photo/Profile picture/log.ico" type="image/x-icon">

</head>
<body>
    <div id="app">
        <header id="header"></header>

        <main class="coupons-page">
            <div class="coupons-container">
                <h2><i class="fas fa-tag"></i> 我的优惠券</h2>
                
                <div v-if="error" class="error-message">
                    {{ error }}
                </div>
                
                <div v-if="isLoading" class="loading-indicator">
                    <i class="fas fa-spinner fa-spin"></i> 加载中...
                </div>
                
                <div v-else-if="coupons.length > 0" class="coupon-list">
                    <div class="coupon-item" v-for="coupon in coupons" :key="coupon.id">
                        <div class="coupon-value">
                            ¥<span>{{ coupon.couponPrice }}</span>
                        </div>
                        <div class="coupon-details">
                            <h3>{{ coupon.couponName }}</h3>
                            <p class="coupon-condition">满{{ coupon.couponCondition }}元可用</p>
                            <p class="coupon-expiry">有效期至: {{ coupon.couponEndTime }}</p>
                            <p class="coupon-remaining">{{ getRemainingDays(coupon.couponEndTime) }}</p>
                        </div>
                        <div class="coupon-status">
                            <span :class="['status-tag', getStatusClass(coupon.couponStatus)]">
                                {{ getStatusText(coupon.couponStatus) }}
                            </span>
                        </div>
                    </div>
                </div>
                
                <div v-else class="no-coupons-message">
                    <p><i class="far fa-frown"></i> 您还没有优惠券哦！</p>
                    <a href="index-ai.html"><i class="fas fa-shopping-cart"></i> 去逛逛</a>
                </div>
            </div>
        </main>
    </div>

    <script src="js/coupons-ai.js"></script>
</body>
</html>